app.controller('RegionDtInfoCtrl', ['$scope','$state', '$stateParams','$http','DiagramService','$anchorScroll','$location',RegionDtInfoCtrl]);

function RegionDtInfoCtrl($scope,$state, $stateParams,$http,DiagramService,$anchorScroll,$location){
	$anchorScroll.yOffset = -40; 
	$location.hash();
	$anchorScroll();

	var maxGroup = [
			{name:'警情',max:20},
			{name:'落地侵财案情',max:20},
			{name:'重点人员',max:20},
			{name:'黄赌毒举报',max:20},
			{name:'流动人口数',max:20},
			{name:'边缘性场所',max:20}
	]

	$scope.radar = {
		'indicator':maxGroup,
		'data':[],
		'name':'得分详情'
	}

	$scope.id = $stateParams.id-1;

	$scope.goBack=function(){
		history.back()
	}

	//显示各组的得分信息
	$scope.dfGroup= {
		'警情':{
			ms:'警情数很多，人均警情比偏移值高25%，七日均值超三十日均值偏移值24%。',
			df:13
		},
		'落地侵财案情':{
			ms:'落地侵财案情数很多，人均警情比偏移值高25%，七日均值超三十日均值偏移值22%。',
			df:9
		},
		'重点人员':{
			ms:'七类重点人员底数千人比均值超全局均值13%，区域七日旅馆、网吧人数超12人。',
			df:7
		},
		'黄赌毒举报':{
			ms:'30日内发生了3次黄赌毒举报。',
			df:6
		},
		'流动人口数':{
			ms:'无异常信息。',
			df:0
		},
		'边缘性场所':{
			ms:'边缘性场所有2所。',
			df:4
		}
	};

    $scope.lineConfig = {
        theme:'default',
        dataLoaded:true
    };
    //警情
    var line = {
    	title:'七日区域人均警情与全局人均警情对比曲线图',
    	legend:['区域人均','全局人均'],
    	xAxis:['5.1','5.2','5.3','5.4','6.1','6.2','6.3','6.4','7.1','7.2','7.3','7.4'],
    	data:[[1.2,2.6,2.4,3.5,4.1,4.5,2.1,1,3,5.5,6.7,7.1],[1,2,3,4,5,5,6,3.4,2.1,2.5,2.2,1]]
    }
    $scope.lineOption = DiagramService.getLine(line.title,line.legend,line.xAxis,line.data)
    var line2 = {
    	title:'七日区域警情均值与前三十日警情均值对比曲线图',
    	legend:['七日警情均值','前三十日警情均值'],
    	xAxis:['5.1','5.2','5.3','5.4','6.1','6.2','6.3','6.4','7.1','7.2','7.3','7.4'],
    	data:[[1.2,2.6,2.4,3.5,4.1,4.5,2,1,3,9,6.7,7.1],[1,2,3,4.3,5,5.2,6,3,2.2,2.5,2.2,1]]
    }
    $scope.lineOption2 = DiagramService.getLine(line2.title,line2.legend,line2.xAxis,line2.data)
   
   //案情
    var line3 = {
    	title:'七日区域人均案情与全局人均案情对比曲线图',
    	legend:['区域人均','全局人均'],
    	xAxis:['5.1','5.2','5.3','5.4','6.1','6.2','6.3','6.4','7.1','7.2','7.3','7.4'],
    	data:[[1.2,2.6,2.4,3.5,4.1,4.5,2,1,3,9,6.7,7.1],[1,2,3,4.3,5,5.2,6,3,2.2,2.5,2.2,1]]
    }
    $scope.lineOption3 = DiagramService.getLine(line3.title,line3.legend,line3.xAxis,line3.data)
 
    var line4 = {
    	title:'七日区域案情均值与前三十日案情均值对比曲线图',
    	legend:['七日案情均值','前三十日案情均值'],
    	xAxis:['5.1','5.2','5.3','5.4','6.1','6.2','6.3','6.4','7.1','7.2','7.3','7.4'],
    	data:[[1.2,2.6,2.4,3.5,4.1,4.5,2,1,3,9,6.7,7.1],[1,2,3,4.3,5,5.2,6,3,2.2,2.5,2.2,1]]
    }
    $scope.lineOption4 = DiagramService.getLine(line4.title,line4.legend,line4.xAxis,line4.data)
 
    //重点人员
    var line5 = {
    	title:'区域七类重点人员千人比均值与全局七类重点人员千人比均值对比曲线图',
    	legend:['区域均值','全局均值'],
    	xAxis:['5.1','5.2','5.3','5.4','6.1','6.2','6.3','6.4','7.1','7.2','7.3','7.4'],
    	data:[[1.2,2.6,2.4,3.5,4.1,4.5,2,1,3,9,6.7,7.1],[1,2,3,4.3,5,5.2,6,3,2.2,2.5,2.2,1]]
    }
    $scope.lineOption5 = DiagramService.getLine(line5.title,line5.legend,line5.xAxis,line5.data)

    var bar1 = {
    	title:'区域七日旅馆、网吧触网人数柱状图',
    	legend:['旅馆触网人数','网吧触网人数'],
    	xAxis:['5.1','5.2','5.3','5.4','6.1','6.2','6.3','6.4','7.1','7.2','7.3','7.4'],
    	data:[[1.2,2.6,2.4,3.5,4.1,4.5,2,1,3,9,6.7,7.1],[1,2,3,4.3,5,5.2,6,3,2.2,2.5,2.2,1]]
    }
    $scope.barOption1 = DiagramService.getStackBar(bar1.title,bar1.legend,bar1.xAxis,bar1.data)


    $scope.jingqings = [
    	{
    		time:'17年6月第4个星期',
    		type1:[
    			{
    				name:'七日区域人均警情数',
    				val:2.5
    			},
    			{
    				name:'七日区域警情均值',
    				val:24.6
    			}
    		],
    		type2:[
    			{
    				name:'全局人均警情数',
    				val:2
    			},
    			{
    				name:'区域前三十日警情均值',
    				val:20
    			}
    		],
    		devi:['25%','23%'],
    		df:[5,6],
    		zdf:11
    	},
		{
    		time:'17年6月第4个星期',
    		type1:[
    			{
    				name:'七日区域人均警情数',
    				val:2.5
    			},
    			{
    				name:'七日区域警情均值',
    				val:24.6
    			}
    		],
    		type2:[
    			{
    				name:'全局人均警情数',
    				val:2
    			},
    			{
    				name:'区域前三十日警情均值',
    				val:20
    			}
    		],
    		devi:['25%','23%'],
    		df:[5,6],
    		zdf:11
    	}

    ]

    $scope.anqings = [
    	{
    		time:'17年6月第4个星期',
    		type1:[
    			{
    				name:'七日区域人均案情数',
    				val:2.5
    			},
    			{
    				name:'七日区域案情均值',
    				val:24.6
    			}
    		],
    		type2:[
    			{
    				name:'全局人均案情数',
    				val:2
    			},
    			{
    				name:'区域前三十日案情均值',
    				val:20
    			}
    		],
    		devi:['25%','23%'],
    		df:[5,6],
    		zdf:11
    	},
		{
    		time:'17年6月第4个星期',
    		type1:[
    			{
    				name:'七日区域人均案情数',
    				val:2.5
    			},
    			{
    				name:'七日区域案情均值',
    				val:24.6
    			}
    		],
    		type2:[
    			{
    				name:'全局人均案情数',
    				val:2
    			},
    			{
    				name:'区域前三十日案情均值',
    				val:20
    			}
    		],
    		devi:['25%','23%'],
    		df:[5,6],
    		zdf:11
    	}

    ]

    $scope.zdry = [
    	{
    		time:'17年6月第4个星期',
    		type1:[
    			{
    				name:'区域七类重点人员千人比均值',
    				val:2.5
    			},
    			{
    				name:'区域七日旅馆触网人数',
    				val:24.6
    			}
    		],
    		type2:[
    			{
    				name:'全局七类重点人员千人比均值',
    				val:2
    			},
    			{
    				name:'区域七日网吧触网人数',
    				val:20
    			}
    		],
    		devi:['25%','23%'],
    		df:[5,6],
    		zdf:11
    	},
		{
    		time:'17年6月第4个星期',
    		type1:[
    			{
    				name:'区域七类重点人员千人比均值',
    				val:2.5
    			},
    			{
    				name:'区域七日旅馆触网人数',
    				val:24.6
    			}
    		],
    		type2:[
    			{
    				name:'全局七类重点人员千人比均值',
    				val:2
    			},
    			{
    				name:'区域七日网吧触网人数',
    				val:20
    			}
    		],
    		devi:['25%','23%'],
    		df:[5,6],
    		zdf:11
    	}

    ]

    $scope.hddcase = [
	    {
	    	time:'2017年6月18日',
	    	zdf:'6',
	    	xq:[
			    {
			    	time:'2017-06-21-23-49-00',
			    	place:'浙江省杭州市江干区同协路378号',
			    	xq:'群众举报有人聚众赌博，声音很吵。'
			    },
			    {
			    	time:'2017-06-21-23-49-00',
			    	place:'浙江省杭州市江干区同协路378号',
			    	xq:'群众举报有人聚众赌博，声音很吵。'
			    }
	    	]
	    },
	    	    {
	    	time:'2017年6月18日',
	    	zdf:'6',
	    	xq:[
			    {
			    	time:'2017-06-21-23-49-00',
			    	place:'浙江省杭州市江干区同协路378号',
			    	xq:'群众举报有人聚众赌博，声音很吵。'
			    },
			    {
			    	time:'2017-06-21-23-49-00',
			    	place:'浙江省杭州市江干区同协路378号',
			    	xq:'群众举报有人聚众赌博，声音很吵。'
			    }
	    	]
	    }

    ]

    $scope.byPlace = [
	    {
	    	name:'西厢阁足浴店',
	    	place:'浙江省杭州市江干区同协路378号',
	    	fb:'无明显异常'
	    },
	    {
	    	name:'西厢阁足浴店',
	    	place:'浙江省杭州市江干区同协路378号',
	    	fb:'无明显异常'
	    }
    ]

    $scope.flowPeople = [
		{
			time:'2017年6月18日',
			amount:'22.5万',
			change:'1000',
			df:'1'
		},
		{
			time:'2017年6月25日',
			amount:'22.5万',
			change:'-2000',
			df:'0'
		},
		{
			time:'2017年7月2日',
			amount:'22.5万',
			change:'-2000',
			df:'0'
		},
		{
			time:'2017年7月9日',
			amount:'22.5万',
			change:'-2000',
			df:'0'
		},
		{
			time:'2017年7月16日',
			amount:'22.5万',
			change:'-2000',
			df:'0'
		},
		{
			time:'2017年7月23日',
			amount:'22.5万',
			change:'-2000',
			df:'0'
		}
		,{
			time:'2017年7月30日',
			amount:'22.5万',
			change:'-2000',
			df:'0'
		}
		,{
			time:'2017年8月6日',
			amount:'22.5万',
			change:'-2000',
			df:'0'
		}
		,{
			time:'2017年8月13日',
			amount:'22.8万',
			change:'-2000',
			df:'0'
		}

	]

	function Date2MonthWeek(day){
		var y = day.getYear();
		var m = day.getMonth()+1;
		var d = day.getDate();
		var date = new Date(y, parseInt(m) - 1, d), w = date.getDay(), dd = date.getDate(); 
		var weekNum = Math.ceil( (dd + 6 - w) / 7); 
		var yy = day.getFullYear();
		return yy+'年'+m+'月第'+weekNum+'周';
	};

	var date = new Date();
	$scope.weekChoice = Date2MonthWeek(date);

}
